<% content_for :left_sidebar do  %>
    <%= render :partial => "layouts/sidebar/xiwenguanli" %>
<% end %>
<%- model_class = News -%>
<div class="page-header">
  <h1>首页显示管理</h1>
</div>
<%= form_tag admins_view_articles_path,:method => :get do %>
    <table class="search_table">
      <tr>
        <td>类型:
          <%= select_tag :article_type,options_for_select([['--请选择--',''],['校园要闻','校园要闻'],['校园快讯','校园快讯'],['热点专题','热点专题']],session[:article_type]) %>
        </td>
      </tr>
      <tr>
        <td colspan="4">
          <%= select_button %>
        </td>
      </tr>
    </table>
<% end %>
<table class="table table-striped">
  <tr>
    <th>顺序</th>
    <th>ID</th>
    <th>标题/名称</th>
    <th>时间</th>
    <th>顺序调整</th>
  </tr>
  <% @dantengs.each_with_index do |dandan,i| %>
    <tr>
      <td><%= i+1 %></td>
      <td><%= dandan.id %></td>
      <td><%= truncate((session[:article_type]=='热点专题' ? dandan.name : dandan.title),:length => 60) %></td>
      <td><%=dandan.created_at.strftime("%Y-%m-%d %H:%M:%S") %></td>
      <td>
        <a href="<%= up_index_admins_view_article_path(dandan.id) %>" data-method="put"><%= image_tag 'shang.gif',size: '20' %></a>
        <% unless dandan.ordinal == 0 %>
            <a href="<%= down_index_admins_view_article_path(dandan.id) %>" data-method="put"><%= image_tag 'xia.gif',size: '20' %></a>
            <a href="<%= del_index_admins_view_article_path(dandan.id) %>" data-method="put"><%= image_tag 'close.gif',size: '20' %></a>
        <% end %>
      </td>
    </tr>
  <% end if @dantengs %>
</table>
<%= paginate @dantengs if @dantengs %>

